//! Params types used in the IPC methods.
//!
//! The current best practice is to follow a single argument type, called "params" for all method (JSON-RPC's style).
//!

use fudata::model::kline::Klt;
use serde::{Deserialize, Serialize};
use ts_rs::TS;
#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/CreateParams.ts")]
pub struct CreateParams<D> {
    /// The data to create.
    pub data: D,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/UpdateParams.ts")]
pub struct UpdateParams<D> {
    /// id of the record to update
    pub id: String,
    /// data to update
    pub data: D,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/ListParams.ts")]
pub struct ListParams<F> {
    /// Filter
    pub filter: Option<F>,
    /// Page
    pub page: Option<u16>,
    /// Size
    pub size: Option<u16>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/GetParams.ts")]
pub struct GetParams {
    /// id
    pub id: String,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/DeleteParams.ts")]
pub struct DeleteParams {
    /// The id of the record to delete.
    pub id: String,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/SecurityFilter.ts")]
pub struct SecurityFilter {
    /// Security ID
    pub id: Option<String>,
    /// Security name
    pub name: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/KlineFilter.ts")]
pub struct KlineFilter {
    /// Security ID e.g. SZ.KZZ.128136
    pub security_id: Option<String>,
    /// klt filter e.g. DAY
    pub klt: Option<Klt>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(
    export,
    export_to = "../../src/lib/bindings/IndicatorCombinationFilter.ts"
)]
pub struct IndicatorCombinationFilter {
    /// security id e.g SZ.KZZ.128136
    pub security_id: String,
    /// klt, e.g. DAY
    pub klt: Klt,
    /// combinnation number
    pub comb_num: u16,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/TradeStrategyFilter.ts")]
pub struct TradeStrategyFilter {
    /// trade strategy id
    pub id: Option<String>,
    /// klt, e.g. DAY
    pub klt: Option<Klt>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/TradeBotFilter.ts")]
pub struct TradeBotFilter {
    /// TradeBot ID
    pub id: Option<String>,
    /// TradeBot Security ID
    pub security_id: Option<String>,
    /// TradeBot Strategy ID
    pub strategy_id: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/TradeOrderFilter.ts")]
pub struct TradeOrderFilter {
    /// TradeOrder ID
    pub id: Option<String>,
    /// TradeBot  ID
    pub trade_bot_id: Option<String>,

    /// start kline_id
    pub start_kline_id: Option<String>,
    /// end kline_id
    pub end_kline_id: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/IndicatorFilter.ts")]
pub struct IndicatorFilter {
    /// indicator ID
    pub id: Option<String>,
}

#[derive(Debug, Serialize, Deserialize, Default, TS)]
#[ts(export, export_to = "../../src/lib/bindings/FudaHistoryFilter.ts")]
pub struct FudaHistoryFilter {
    /// indicator ID
    pub id: Option<String>,
}
